Skip to content

feat(signals): start the personal ranking build when a first activity summary lands - #133661

Merged
trunk-io[bot] merged 1 commit into
masterfrom
posthog/personal-ranking-first-summary-build
Nov 11, 2026
Merged

trunk-io[bot] merged 1 commit into
masterfrom
posthog/personal-ranking-first-summary-build

Conversation

@posthog

@posthog posthog Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem

  • New people keep the Recommended inbox order after their first activity summary lands, until a personal ranking tick builds their list.
  • Follows #133442, which made the first summary arrive sooner.

Closes #133427

Origin

  • Team member
  • First signal: 2026-11-11
  • Inbox report: open
  • Task started by: a person, from the inbox

Changes

  • A person's first list now builds as soon as their first summary is stored.
  • The build uses the on-demand gates and runs only when it calls the model. Otherwise the tick keeps the pair.
  • A new first_summary trigger marks these builds.
  • The hook is in the tick's run_pair, because a call from update_activity_summary creates an import cycle.

The activity summary tick now also starts a personal ranking build:

flowchart LR
  A[Activity summary tick]:::y --> B[Store summary]:::g
  C[Personal ranking tick]:::y --> D[Build list]:::b
  classDef y fill:#f9bd2b,stroke:#f9bd2b,color:#000;
  classDef g fill:#e5e7eb,stroke:#c7ccd1,color:#000;
  classDef b fill:#1d4aff,stroke:#1d4aff,color:#fff;
Loading
flowchart LR
  A[Activity summary tick]:::y --> B[Store summary]:::g
  B -- first summary, no list --> E[Celery build, first_summary]:::b
  C[Personal ranking tick]:::y --> D[Build list]:::b
  classDef y fill:#f9bd2b,stroke:#f9bd2b,color:#000;
  classDef g fill:#e5e7eb,stroke:#c7ccd1,color:#000;
  classDef b fill:#1d4aff,stroke:#1d4aff,color:#fff;
Loading

How did you test this code?

Test rationale:

  • A parameterized case covers candidates, an existing list, a disabled payload, and no candidates.
  • The OK-update tick test now asserts that the build is queued.
  • Not run: a real Celery worker.

Release status

  • This change is behind a feature flag and is not available to users

Docs update

  • Updated products/signals/backend/management/AGENTS.md.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: Claude Code, Opus 5.5 (claude-opus-5-5)

Skills: /writing-tests, /writing-code-comments, /editing-agents-md, /writing-pr-descriptions

More context for AI agents
  • Session: PostHog Desktop task from an inbox report. Tools: PostHog MCP, pytest via hogli.
  • Decisions: The build skips tick enrollment, as the report asked. Cost stays bounded by the shared limit and the candidates requirement.
  • Decisions: A second or later summary queues nothing. It reaches the tick as changed_activity_summary_version.
  • Read closely: personal_ranking_tasks.py, start_first_summary_build and _skip_build.
  • Follow-ups: Within 48 hours of deploy, check for personal inbox ranking built events with trigger = first_summary.

Created with PostHog Desktop from an inbox report

🤖 Generated with Claude Code

… summary lands

When the activity summary tick stores a person's first summary and the person has no personal inbox list, queue build_personal_inbox_ranking with a new first_summary trigger. The build uses the on-demand gates (enabled payload, per-person lock, shared daily build limit) and runs only when it calls the model. A refused build leaves the pair to the personal ranking tick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: 76a8da32-1039-4490-b913-424cb0a74167
@posthog posthog Bot added the self-driving label Nov 11, 2026
@posthog
posthog Bot marked this pull request as ready for review November 11, 2026 14:36
@trunk-io

trunk-io Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@stamphog
stamphog Bot requested a review from a team November 11, 2026 14:36
@posthog
posthog Bot requested a review from andrewm4894 November 11, 2026 14:36
@parameterai

parameterai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Risk: No findings

This PR queues a build_personal_inbox_ranking Celery task (new first_summary trigger) from the activity summary tick when a person's first summary is stored and they have no ranking row. I traced the new path end to end: the build is gated by the flag's enabled, the per-person cache lock, no-existing-row, model-only execution (which folds in AI data-processing approval via may_call_model), and the shared max_builds_per_day bucket, so I found no exploitable bypass.

Sentinel reviewed f0de76b · Review settings

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Trunk lane — backend Python lane

This PR is assigned to the backend Python lane. It runs backend Python tests and may merge in parallel with PRs in other lanes.

✅ Duplication (Python) — clean

New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

✅ Duplication (TypeScript) — clean

New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

⚠️ Backend coverage — 89.0% of changed backend lines covered — 6 uncovered

🧪 Backend test coverage

Patch coverage — changed backend lines (products + core): ██████████████████░░ 89.0% (49 / 55)

File Patch Uncovered changed lines
products/signals/backend/activity_summary/tick.py 66.7% 411, 413
products/signals/backend/personal_ranking_tasks.py 81.8% 79, 82–84

🤖 Agents: add a test only if an uncovered line exposes a realistic regression that existing tests miss. Otherwise explain why no new test is needed under "How did you test this code?". Gap list: the patch-coverage artifact on this run (gh run download 321291394039840 -n patch-coverage), or the coverage-data block at the end of this comment.

Per-product line coverage (touched products)
Product Coverage Lines
platform_features ██░░░░░░░░░░░░░░░░░░ 12.1% 7 / 58
data_tools ████████████░░░░░░░░ 57.6% 95 / 165
warehouse_sources_queue █████████████░░░░░░░ 65.8% 2,192 / 3,330
demo ██████████████░░░░░░ 71.3% 1,978 / 2,775
knowledge_writer ████████████████░░░░ 77.7% 1,409 / 1,813
batch_exports █████████████████░░░ 82.9% 24,782 / 29,885
engineering_analytics █████████████████░░░ 85.6% 12,515 / 14,615
ml_inference █████████████████░░░ 86.3% 524 / 607
commands █████████████████░░░ 86.5% 1,645 / 1,901
mcp_analytics ██████████████████░░ 87.8% 6,827 / 7,777
posthog_ai ██████████████████░░ 88.2% 4,514 / 5,116
apm ██████████████████░░ 88.2% 1,973 / 2,236
notebooks ██████████████████░░ 88.6% 15,594 / 17,599
dashboards ██████████████████░░ 89.5% 8,969 / 10,017
cohorts ██████████████████░░ 90.7% 9,866 / 10,883
warehouse_suggestions ██████████████████░░ 90.7% 4,264 / 4,700
actions ██████████████████░░ 90.9% 1,524 / 1,677
visual_review ██████████████████░░ 90.9% 10,634 / 11,698
data_warehouse ██████████████████░░ 91.1% 15,984 / 17,546
signals ██████████████████░░ 91.2% 112,499 / 123,339
cdp ██████████████████░░ 91.4% 10,845 / 11,865
today ██████████████████░░ 91.5% 4,136 / 4,521
canvas ██████████████████░░ 91.5% 8,559 / 9,351
tasks ██████████████████░░ 91.6% 86,251 / 94,204
autoresearch ██████████████████░░ 91.6% 12,203 / 13,318
data_modeling ██████████████████░░ 91.7% 12,686 / 13,831
streamlit_apps ██████████████████░░ 92.0% 3,200 / 3,478
alerts_platform ██████████████████░░ 92.0% 10,654 / 11,576
release ██████████████████░░ 92.1% 453 / 492
metrics ██████████████████░░ 92.1% 12,068 / 13,102
business_knowledge ██████████████████░░ 92.2% 10,900 / 11,824
review_hog ██████████████████░░ 92.3% 18,397 / 19,930
conversations ██████████████████░░ 92.4% 31,728 / 34,335
wizard ██████████████████░░ 92.4% 7,323 / 7,922
error_tracking ███████████████████░ 92.5% 20,976 / 22,675
slack_app ███████████████████░ 92.6% 25,544 / 27,600
early_access_features ███████████████████░ 92.7% 1,377 / 1,486
notifications ███████████████████░ 92.8% 1,230 / 1,326
legal_documents ███████████████████░ 93.0% 2,380 / 2,558
ai_training ███████████████████░ 93.1% 605 / 650
managed_warehouse ███████████████████░ 93.2% 15,792 / 16,947
authorization ███████████████████░ 93.2% 850 / 912
alerts ███████████████████░ 93.2% 13,753 / 14,756
webmcp ███████████████████░ 93.3% 277 / 297
stamphog ███████████████████░ 93.3% 11,441 / 12,265
web_analytics ███████████████████░ 93.5% 27,059 / 28,934
surveys ███████████████████░ 93.6% 7,847 / 8,388
exports ███████████████████░ 93.7% 4,474 / 4,777
approvals ███████████████████░ 93.7% 5,020 / 5,359
cross_project_dashboards ███████████████████░ 93.7% 867 / 925
context_layer ███████████████████░ 93.9% 4,075 / 4,342
messaging ███████████████████░ 93.9% 9,228 / 9,827
marketing_analytics ███████████████████░ 93.9% 22,429 / 23,882
mcp_store ███████████████████░ 94.0% 9,391 / 9,991
ai_gateway ███████████████████░ 94.0% 1,472 / 1,566
workflows ███████████████████░ 94.0% 29,658 / 31,549
billing_alerts ███████████████████░ 94.0% 2,332 / 2,480
annotations ███████████████████░ 94.1% 1,460 / 1,552
managed_migrations ███████████████████░ 94.2% 1,886 / 2,003
customer_analytics ███████████████████░ 94.2% 31,699 / 33,658
ai_observability ███████████████████░ 94.3% 38,322 / 40,635
access_control ███████████████████░ 94.3% 8,606 / 9,122
replay_vision ███████████████████░ 94.4% 33,431 / 35,422
logs ███████████████████░ 94.4% 20,533 / 21,748
reminders ███████████████████░ 94.5% 837 / 886
experiments ███████████████████░ 95.0% 47,368 / 49,882
warehouse_sources ███████████████████░ 95.0% 142,320 / 149,854
growth ███████████████████░ 95.0% 11,602 / 12,216
endpoints ███████████████████░ 95.0% 9,725 / 10,239
product_tours ███████████████████░ 95.1% 1,271 / 1,337
skills ███████████████████░ 95.1% 7,658 / 8,053
uptime_monitoring ███████████████████░ 95.3% 306 / 321
data_catalog ███████████████████░ 95.6% 4,749 / 4,965
tracing ███████████████████░ 95.7% 5,087 / 5,315
ui_customization ███████████████████░ 95.7% 714 / 746
subscriptions ███████████████████░ 95.7% 14,176 / 14,811
product_analytics ███████████████████░ 95.8% 31,450 / 32,836
feature_flags ███████████████████░ 95.8% 30,752 / 32,104
revenue_analytics ███████████████████░ 95.9% 1,877 / 1,958
aeo ███████████████████░ 95.9% 4,131 / 4,308
data_quality ███████████████████░ 96.0% 8,583 / 8,937
groups ███████████████████░ 96.4% 2,068 / 2,145
account_audits ███████████████████░ 96.5% 823 / 853
security ███████████████████░ 96.8% 1,597 / 1,650
pulse ███████████████████░ 97.0% 2,026 / 2,089
analytics_platform ████████████████████ 98.0% 2,962 / 3,022
field_notes ████████████████████ 98.4% 181 / 184

Report-only. Patch coverage = changed backend lines covered vs origin/master. Sorted lowest first.
Known gaps: lines covered only by Temporal tests show as uncovered; core line numbers may drift if master changed the same file.

@andrewm4894

Copy link
Copy Markdown
Member

/trunk merge

@trunk-io
trunk-io Bot merged commit f2ff072 into master Nov 11, 2026
375 of 419 checks passed
@trunk-io
trunk-io Bot deleted the posthog/personal-ranking-first-summary-build branch November 11, 2026 15:59
@deployment-status-posthog

deployment-status-posthog Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-11-11 16:39 UTC Run
prod-us ✅ Deployed 2026-11-11 18:14 UTC Run
prod-eu ✅ Deployed 2026-11-11 17:23 UTC Run

This table shows the posthog release only. Hogstation shows every service that this PR reaches, Kargo services included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(signals): start the personal ranking build when a first activity summary lands

1 participant